<template>
  <header id="header">
    <div class="logo">
      <router-link to="/">Logo</router-link>
      <!-- <a href="#">Logo</a> -->
    </div>
    <!-- 独立页面的标题 -->
    <div class="single-title" v-if="isSingle">
      {{title}}
    </div>
    <!-- 第一个是menu图标 -->
    <div class="more" v-if="type===MENU">
      <div class="line"></div>
      <div class="line"></div>
      <div class="line"></div>
    </div>
    <!-- 第二个是搜索图表 -->
    <div class="more" v-if="type===SEARCH">
      <div class="line"></div>
      <div class="line"></div>
      <div class="line"></div>
    </div>
    <!-- 第三个是四叶草图标 -->
    <div class="more" v-if="type===SQUARE">
      <span class="square"></span>
      <span class="square"></span>
      <span class="square"></span>
      <span class="square"></span>
      </div>
    <div class="download">下载APP</div>
  </header>
</template>
<script>
import { MENU, SEARCH, SQUARE } from "../../../static/const";
export default {
  data() {
    return { MENU, SEARCH, SQUARE };
  },
  computed: {
    // 右边图标的类型
    type() {
      return this.$store.state.singleSection.type;
    },
    // 是否有独立页面
    isSingle() {
      console.log("OK:" + MENU);
      return this.$store.state.singleSection.is;
    },
    // 如果有独立页面那么标题是什么
    title() {
      return this.$store.state.singleSection.title;
    }
  }
};
</script>

<style lang="less">
@rem: 72rem;
#header {
  padding: 0 10 / @rem;
  width: 720 / @rem;
  height: 100 / @rem;
  border-bottom: 1px solid #c3c3c3;
  > .logo {
    font-size: 40 / @rem;
    font-weight: bold;
    line-height: 99 / @rem;
    float: left;
  }
  > .single-title {
    float: left;
    border-left: 2px solid #c3c3c3;
    padding-left: 20 / @rem;
    margin-left: 20 / @rem;
    height: 30 / @rem;
    font-size: 24 / @rem;
    margin-top: 50 / @rem;
  }
  > .download {
    float: right;
    height: 30 / @rem;
    // border-box,而且border不为0,会影响这个
    line-height: 30 / @rem;
    margin-right: 20 / @rem;
    margin-top: 36 / @rem;
    padding: 0 8px;
    border: 1px solid #00a5eb;
    color: #00a5eb;
    font-size: 14em;
    border-radius: 6 / @rem;
  }
  > .more {
    // cursor: pointer;
    float: right;
    margin-top: 34 / @rem;
    width: 40 / @rem;
    height: 40 / @rem;
    > .line {
      width: 40 / @rem;
      height: 6 / @rem;
      background-color: black;
      margin-bottom: 8 / @rem;
    }
    >.square{
      float: left;
      width: 18/@rem;
      height: 18/@rem;
      border: 4/@rem solid black;
      margin-bottom: 4/@rem;
      &:nth-child(2n+1){
        margin-right: 4/@rem;
      }
    }
  }
}
</style>